using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _ReplaceString_.UI;

// Direction Enum
[Flags]
public enum Direction
{
	Zero = 0,
	Inner = 1,
	Left = 2,
	Right = 4,
	Up = 8,
	Down = 16,
	Outer = 32,
	LeftUp = Left | Up,
	LeftDown = Left | Down,
	RightUp = Right | Up,
	RightDown = Right | Down,
	LeftRight = Left | Right,
	UpDown = Up | Down,
}

// Direction extensions
public static class DirectionExtensions
{
	// ToVector2
	public static Vector2 ToVector2(this Direction direction)
	{
		return direction switch
		{
			Direction.Left => new Vector2(-1, 0),
			Direction.Right => new Vector2(1, 0),
			Direction.Up => new Vector2(0, -1),
			Direction.Down => new Vector2(0, 1),
			Direction.LeftUp => new Vector2(-1, -1),
			Direction.LeftDown => new Vector2(-1, 1),
			Direction.RightUp => new Vector2(1, -1),
			Direction.RightDown => new Vector2(1, 1),
			_ => Vector2.Zero,
		};
	}
}
